package cn.easybuy.service.impl;

import cn.easybuy.dao.UserDAO;
import cn.easybuy.dao.impl.UserDAOImpl;
import cn.easybuy.entity.PageInfo;
import cn.easybuy.entity.User;
import cn.easybuy.service.UserService;

import java.sql.SQLException;
import java.util.List;

import java.sql.SQLException;

public class UserServiceImpl implements UserService {
    UserDAO userDAO = new UserDAOImpl();
    @Override
    public boolean addUser(User u) throws SQLException {
        int i = userDAO.addUser(u);

        if (i>0){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public boolean delUsers(User u) throws SQLException {
        int i = userDAO.delUsers(u);

        if (i>0){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public boolean updUsers(User u) throws SQLException {
        int i = userDAO.updUsers(u);

        if (i>0){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public List<User> getListAll() throws SQLException {
        return userDAO.getListAll();
    }

    @Override
    public PageInfo<User> listPage(PageInfo<User> page) throws Exception {
        return userDAO.listPage(page);
    }
    @Override
    public boolean AddNews(User user) throws SQLException {
        int i = userDAO.AddNews(user);
        if (i>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public User selectUserInfo(User u) throws SQLException {
        return userDAO.selectUserInfo(u);
    }

    @Override
    public User checkLogin(User u) throws SQLException {
        return userDAO.checkLogin(u);
    }
}
